Skip to content

Include StaticRecompCore.h where the interpreter uses it - #7

Open
dougchansan wants to merge 1 commit into
ExpansionPak:moderngekko-vendorfrom
dougchansan:interpreter-staticrecomp-include
Open

Include StaticRecompCore.h where the interpreter uses it#7
dougchansan wants to merge 1 commit into
ExpansionPak:moderngekko-vendorfrom
dougchansan:interpreter-staticrecomp-include

Conversation

@dougchansan

@dougchansan dougchansan commented Aug 4, 2026

Copy link
Copy Markdown

core does not compile at the moderngekko-vendor tip (7275711) with MSVC:

Interpreter.cpp(294): error C2065: 'g_static_recomp_core': undeclared identifier
Interpreter.cpp(299): error C2065: 'ppc_state': undeclared identifier

unknown_instruction reads both, but the translation unit includes neither the header declaring g_static_recomp_core (Core/PowerPC/StaticRecomp/StaticRecompCore.h) nor a binding for ppc_state. It is not reached through the precompiled header either — pch.h does not pull in StaticRecompCore.h.

The ppc_state binding already existed further down the same function, past the first use. This moves it to the top so it serves both uses; adding a second one is a redefinition (C2374).

Found while building moderngekko-launcher from ModernGekko master. It is the second of two breaks in that path — the first is the unguarded PCH flags, already fixed on this branch, which is why this one was not visible until now.

Two lines, no behaviour change.

How this fits

These land together as a set: savestates working end to end, the Windows build
and test suite being usable at all, and CI so none of it regresses unnoticed.
This PR is RC #7.

MG #18 Bump vendored RecompCore prerequisite - without it the launcher cannot compile on Windows (C sources get a C++ PCH)
RC #7 Interpreter.cpp include prerequisite - core does not compile without it
RC #8 In-game File/View menu and hotkeys introduces Core/SavestateLayout.h, the one definition of where savestates live, what they are called and how they are ordered
MG #21 Launcher savestate picker, --load-state consumes that header, so the launcher and the in-game menu cannot disagree
MG #22 Make the test suite pass on Windows land before CI, or the first run is red on day one
MG #23 Build and test on PRs, three platforms the reason the rest stayed broken unnoticed
RC #10 CI on PRs, the vendored branch, and Windows same gap, other repo; its Windows job fails until RC #7 lands
MG #19 --opt-level, default -O2 independent
MG #20 Cache-domain affinity independent

Suggested order: #18 and RC #7, then RC #8, then MG #21; MG #22 before MG
#23
. The rest are independent.

Verified on three platforms: Windows (MSVC + clang), Linux (g++ 15.2, x86_64) and
macOS 26.1 (clang, arm64). The portable pieces - the savestate layout and its
tests, frontend_config, dol_patch - build and pass on all three. Windows-only
pieces are guarded and their tests registered behind if(WIN32).

unknown_instruction reads g_static_recomp_core and ppc_state, but the
translation unit includes neither the header that declares the former nor
a binding for the latter, so core does not compile:

  Interpreter.cpp(294): error C2065: 'g_static_recomp_core': undeclared identifier
  Interpreter.cpp(299): error C2065: 'ppc_state': undeclared identifier

It is not reached through the PCH either -- pch.h does not pull in
StaticRecompCore.h.

The ppc_state binding already existed further down the same function, past
the first use. Moving it to the top serves both uses rather than adding a
second one, which would be a redefinition.
@dougchansan

Copy link
Copy Markdown
Author

Since there are now 17 open PRs across RecompCore, ModernGekko and DolRecomp, here is a suggested merge order. Posting it here because this one has to land first regardless.

Merge these three first, in this order

  1. RecompCore Include StaticRecompCore.h where the interpreter uses it #7 (this PR) — moderngekko-vendor HEAD does not compile without it, so every other RecompCore PR is untestable until it lands.
  2. RecompCore JitArm64: implement the StaticRecomp fallback contract #6 — the JitArm64 fallback contract. Without it the recompiled module is entered once at boot and never again on arm64, so anything measured as "static recomp" on Apple Silicon is really JitArm64.
  3. RecompCore GXRuntime: inline the hot paths of the FP gate and paired-single access #9 — the inline FP gate and paired-single path. DolRecomp #12 does not compile without it: the emitted code references runtime names this PR introduces.

Everything else can follow in any order, subject to the two rules below.

The two ordering rules that matter

Rebase clusters — annoyance, not blockers

Whichever lands first, the others need a trivial rebase:

file PRs
Source/Core/Core/PowerPC/Interpreter/Interpreter.cpp RecompCore #7, #8
CMakeLists.txt ModernGekko #17, #20, #21, #22
tools/moderngekko_run.cpp ModernGekko #20, #21
src/backend/emitter.c DolRecomp #12, #13

All 17 report MERGEABLE against their bases as of today, so these are the only collisions.

Worth knowing before reviewing

  • RecompCore module-template: fix the IPO check, and default IPO off #11 needs a decision, not just review. It fixes a support check that failed silently on macOS — no module was ever built with -flto=thin despite every manifest recording it — and separately flips IPO off by default because LTO measured −0.8% on arm64. On Linux the check passes, so those builds presumably have had LTO all along and the default change would remove it. The two halves are independent; taking only the check fix is reasonable.
  • ModernGekko #17 is worth more than its four lines suggest. It fixes a stale-recompiler-copy trap that has now caused a wrong result twice, on two platforms.
  • Absolute fps figures in RecompCore JitArm64: implement the StaticRecomp fallback contract #6 and GXRuntime: inline the hot paths of the FP gate and paired-single access #9 were measured under a 2.02× CPU throttle (macOS Low Power Mode, found yesterday). Correcting comments are on both PRs. The relative deltas in every PR are unaffected — they were alternating A/B arms inside a single session, so a constant throttle scales both arms and cancels — as is JitArm64: implement the StaticRecomp fallback contract #6's JIT ratio, which re-measures at 5.58× against the 5.9× claimed.
  • DolRecomp #13 has been re-measured since it was opened: the original "+2.9%, ranges overlap, I would understand a decline" is now +10.6% with non-overlapping ranges on an unthrottled machine, with the artifact verified before measuring. Its description is updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant